{% extends 'layout.html' %}

{% block content %}
    {% load permission %}
    <div style="margin-bottom: 5px;" class="clearfix">
        {% add_permission request 'level_add' %}
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>标题</th>
            <th>折扣</th>
            {% if request|check_permission:"level_edit,level_delete" %}
                <th>操作</th>
            {% endif %}
        </tr>
        </thead>
        <tbody>
        {% for row in queryset %}
            <tr>
                <td>{{ row.id }}</td>
                <td>{{ row.title }}</td>
                <td>{{ row.percent }}%</td>
                {% if request|check_permission:"level_edit,level_delete" %}
                    <td>
                        {% edit_permission request 'level_edit' row.id %}
                        {% delete_url_permission request 'level_delete' row.id %}
                    </td>
                {% endif %}
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}
